import http from '@/libs/http'

/**
 * OSS文件上传URL地址
 */
export const UPLOAD_URL = 'http://gateway.sport.com/system/oss/upload'

/**
 * 添加数据
 * @param data
 */
export function created(data) {
    return http({
        url: '/system/oss/add',
        method: 'post',
        data
    })
}

/**
 * 根据ID删除数据(批量删除)
 * 发送复杂请求（DELETE）时设置withCredentials为true报错
 * @param data：{"idList": ["1","2"]}
 */
export function deleted(data) {
    return http({
        url: '/system/oss/delete',
        method: 'post',
        data
    })
}

/**
 * 修改数据
 * @param data
 */
export function updated(data) {
    return http({
        url: '/system/oss/update',
        method: 'post',
        data
    })
}

/**
 * 根据IdD查询单条数据
 * @param id
 */
export function selectOne(id) {
    return http({
        url: '/system/oss/get/'+id,
        method: 'get'
    })
}

/**
 * 多条件查询数据列表
 * @param query
 */
export function selectList(query) {
    return http({
        url: '/system/oss/list',
        method: 'get',
        params: query
    })
}

/**
 * 多条件查询分页数据
 * @param query
 */
export function selectPage(query) {
    return http({
        url: '/system/oss/page',
        method: 'get',
        params: query
    })
}

/**
 *新增或修改OSS配置
 * @param data
 */
export function setConfig(data) {
    return http({
        url: '/system/oss/config/setConfig',
        method: 'post',
        data
    })
}

/**
 * 根据云服务商名查询OSS配置
 * @param ossName
 */
export function findByOssName(ossName) {
    return http({
        url: '/system/oss/config/findByOssName/'+ossName,
        method: 'get'
    })
}

export function selectListOssConfig(query) {
    return http({
        url: '/system/oss/config/list',
        method: 'get',
        params: query
    })
}